package com.yidu.TAManagement.mapper;


import com.yidu.TAManagement.entity.TABusiness;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Repository
@Mapper
public interface TABusinessMapper {
    /**
     * 增加基金信息
     * @param taBusiness
     * @return int
     */
    @Insert("insert into TABusiness values(#{taId},#{fundId},#{cashId},#{businessType},#{businessNum},#{businessMoney},#{businessTime},#{businessPrice},#{businessEndTime},#{agencies},#{totalMoney},#{realityMoney},#{businessState})")
    public int insertTABusiness(TABusiness taBusiness);
    /**
     * 修改基金信息
     * @param taBusiness】
     * @return
     */
    @Update("update TABusiness set fundId=#{fundId},cashId=#{cashId},businessType=#{businessType},businessNum=#{businessNum},businessMoney=#{businessMoney},businessTime=#{businessTime},businessPrice=#{businessPrice},businessEndTime=#{businessEndTime},agencies=#{agencies},totalMoney=#{totalMoney},realityMoney=#{realityMoney},businessState=#{businessState} where TAId=#{taId}")
    public int updateTABusiness(TABusiness taBusiness);
    /**
     * 删除基金信息
     * @param taId
     * @return
     */
    @Delete("delete from TABusiness where TaId=#{taId}")
    public int deleteTABusiness(String taId);

    /**
     * 按条件查询加分页
     * @param taBusinessMap 查询的条件  页码 每页显示的行数
     * @return 返回基金的集合
     *  ${strWhere} =“   and userName  like '%admin%' and roleId =1 ”
     */
    @Select("select * from tabusiness where 1=1  ${strWhere} limit #{start},#{pageRows}")
    public List<TABusiness> selectTABusiness(Map taBusinessMap);

    @Select("select count(*) from TABusiness where 1=1  ${strWhere}")
    public int total(Map taBusinessMap);
}
